package com.cloud.cmt.usermanage.dict.util;

import com.cloud.cmt.usermanage.dict.entity.Dictionary;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * User: wcy
 * Date: 2017/2/16
 * Time: 16:35
 */
@Component("DictData")
public class DictData {

    private static Map<String,Object> dicMap = new HashMap<String,Object>();

    private static Map<String,Object> dicNodeMap = new HashMap<String,Object>();

    public static List<Dictionary> getDicListMapByCode(String code) {
        return (List<Dictionary>) dicMap.get(code);
    }

    public static Dictionary getDicMapByCode(String code) {
        if(dicNodeMap.get(code)!=null)
            return (Dictionary) dicNodeMap.get(code);
        return null;
    }

    public static void setDicMap(String key, Object value) {
        dicMap.put(key,value);
    }

    public static void setDicNodeMap(String key, Object value) {
        dicNodeMap.put(key,value);
    }

    public static void clearMap() {
        dicMap.clear();
        dicNodeMap.clear();
    }

}
